import { getHomeGoodPriceData } from "@/services"
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit"

export const fetchHomeDataAction = createAsyncThunk("fetchdata", async (payload) => {
    const result = await getHomeGoodPriceData()
    return result
})

const homeSlice = createSlice({
    name: "home",
    initialState: {
        goodPriceInfo: {},
    },
    reducers: {},
    extraReducers: {
        [fetchHomeDataAction.fulfilled](state, { payload }) {
            state.goodPriceInfo = payload
        },
    },
})

export default homeSlice.reducer
